function rotatePoint(s, t, angle) {
    var a = 0.5
    var b = 0.5
    var rx =
        a +
        (s - a) * Math.cos((angle * Math.PI) / 180) -
        (t - b) * Math.sin((angle * Math.PI) / 180)
    var ry =
        b +
        (s - a) * Math.sin((angle * Math.PI) / 180) +
        (t - b) * Math.cos((angle * Math.PI) / 180)

    return {
        s: Math.floor(rx * 1000000) / 1000000,
        t: Math.floor(ry * 1000000) / 1000000
    }
}
function normalization(distribution, max, min) {
    return (distribution - min) / (max - min)
}
function getST(position, angle, maxLon, minLon, maxLat, minLat) {
    // var pointNum = position.length
    var sts = []
    for (var i = 0; i < position.length; i = i + 3) {
        var s = normalization(position[i], maxLon, minLon)
        var t = normalization(position[i + 1], maxLat, minLat)
        var rst = rotatePoint(s, t, angle)

        sts.push(rst.s)
        sts.push(rst.t)
    }
    return sts
}
function getSTOut(position, angle, maxLon, minLon, maxLat, minLat) {
    // var pointNum = position.length
    var sts = []
    for (var i = 0; i < position.length; i = i + 3) {
        var s = normalization(position[i], maxLon, minLon)
        var t = normalization(position[i + 1], maxLat, minLat)


        sts.push(s)
        sts.push(t)
    }
    return sts
}
